package com.heima.admin.controller.v1;

import com.heima.admin.service.AdSensitiveService;
import com.heima.apis.admin.AdSensitiveControllerApi;
import com.heima.model.admin.dtos.SensitiveDto;
import com.heima.model.admin.pojos.AdSensitive;
import com.heima.model.common.dtos.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api/v1/sensitive")
public class AdSensitiveController implements AdSensitiveControllerApi {

    @Autowired
    AdSensitiveService adSensitiveService;

    @PostMapping("/list")
    @Override
    public ResponseResult list(@RequestBody SensitiveDto dto) {
        ResponseResult list = adSensitiveService.list(dto);
        return list;
    }

    @Override
    @PostMapping("/save")
    public ResponseResult insert(@RequestBody AdSensitive sensitive) {
        ResponseResult insert = adSensitiveService.insert(sensitive);
        return insert;
    }

    @Override
    @PostMapping("/update")
    public ResponseResult update(@RequestBody AdSensitive sensitive) {
        ResponseResult update = adSensitiveService.update(sensitive);
        return update;
    }

    @Override
    @GetMapping("/del/{id}")
    public ResponseResult delete(@PathVariable("id") Integer id) {
        ResponseResult delete = adSensitiveService.delete(id);
        return delete;
    }

}
